package command.conta_corrente;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.Estado;

import dao.DAOContaCorrente;

@WebServlet("/ServletContaCorrente")
public class ServletContaCorrente extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public ServletContaCorrente() {
        super();
    }

	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession();
		DAOContaCorrente dao = new DAOContaCorrente();
		ArrayList<Estado> estados = (ArrayList<Estado>) dao.getEstadosBrasileiros();
		
		for (int i = 0; i < estados.size(); i++) {
			Estado e  = estados.get(i);
		}
		session.setAttribute("estados", estados);
		RequestDispatcher rd = request.getRequestDispatcher("/htmls/conta_corrente/criar_cc.jsp");
		rd.forward(request, response);
	}
}
